package com.mapbar.ure.frontend.lr1.table;

import com.mapbar.ure.ProductionType;
import com.mapbar.ure.frontend.lr1.LR1Item;
import com.mapbar.ure.utils.TwoKeysHashMap;

public class Action {

	TwoKeysHashMap<Integer, ProductionType, ActionItem> table = new TwoKeysHashMap<Integer, ProductionType, ActionItem>();

	@Override
	public String toString() {
		return table.toString();
	}

	public void addRow(int i, ProductionType nextSymbol, ActionType shift, int j) {
		table.put(i, nextSymbol, new ActionItem(shift, j));
	}

	public void addRow(int i, ProductionType terminalSymbol, ActionType reduce,
			LR1Item item) {
		table.put(i, terminalSymbol, new ActionItem(reduce, item));
	}

	public void addRow(int i, ProductionType eof, ActionType accept) {
		table.put(i, eof, new ActionItem(accept));
	}

	public ActionItem get(int i, ProductionType t) {
		return table.get(i, t);
	}
}
